From 16ada8307b0170bb4343ae7e163bd3dc9aa98b49 Mon Sep 17 00:00:00 2001 From: Van Waholtz Date: Mon, 1 Sep 2025 01:22:20 +0800 Subject: [PATCH] sing-box: add variant tiny The tiny version disables tailscale by default for small package size. OpenWrt also has the tailscale package as an alternative. We prefer to keep the base version has the same build tags with the upstream releases for compatibility. Signed-off-by: Van Waholtz --- net/sing-box/Makefile | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/net/sing-box/Makefile b/net/sing-box/Makefile index 7a3da84e6f..b56feaa932 100644 --- a/net/sing-box/Makefile +++ b/net/sing-box/Makefile @@ -31,6 +31,8 @@ define Package/sing-box URL:=https://sing-box.sagernet.org DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle +kmod-inet-diag +kmod-tun USERID:=sing-box=5566:sing-box=5566 + VARIANT:=full + DEFAULT_VARIANT:=1 endef define Package/sing-box/description @@ -38,6 +40,16 @@ define Package/sing-box/description ShadowTLS, Tor, trojan, VLess, VMess, WireGuard and so on. endef +define Package/sing-box-tiny + $(Package/sing-box) + TITLE+=(tiny) + PROVIDES:=sing-box + VARIANT:=tiny + CONFLICTS:=sing-box +endef + +Package/sing-box-tiny/description:=$(Package/sing-box/description) + define Package/sing-box/config menu "Select build options" depends on PACKAGE_sing-box @@ -96,6 +108,12 @@ PKG_CONFIG_DEPENDS:= \ CONFIG_SINGBOX_WITH_V2RAY_API \ CONFIG_SINGBOX_WITH_WIREGUARD +ifeq ($(BUILD_VARIANT),tiny) +ifeq ($(CONFIG_SMALL_FLASH),) +GO_PKG_TAGS:=with_gvisor +endif +GO_PKG_TAGS:=$(GO_PKG_TAGS),with_quic,with_utls,with_clash_api +else GO_PKG_TAGS:=$(subst $(space),$(comma),$(strip \ $(if $(CONFIG_SINGBOX_WITH_ACME),with_acme) \ $(if $(CONFIG_SINGBOX_WITH_CLASH_API),with_clash_api) \ @@ -109,12 +127,15 @@ GO_PKG_TAGS:=$(subst $(space),$(comma),$(strip \ $(if $(CONFIG_SINGBOX_WITH_V2RAY_API),with_v2ray_api) \ $(if $(CONFIG_SINGBOX_WITH_WIREGUARD),with_wireguard) \ )) +endif define Package/sing-box/conffiles /etc/config/sing-box /etc/sing-box/ endef +Package/sing-box-tiny/conffiles=$(Package/sing-box/conffiles) + define Package/sing-box/install $(INSTALL_DIR) $(1)/usr/bin/ $(INSTALL_BIN) $(GO_PKG_BUILD_BIN_DIR)/sing-box $(1)/usr/bin/sing-box @@ -128,4 +149,7 @@ define Package/sing-box/install $(INSTALL_BIN) ./files/sing-box.init $(1)/etc/init.d/sing-box endef +Package/sing-box-tiny/install=$(Package/sing-box/install) + $(eval $(call BuildPackage,sing-box)) +$(eval $(call BuildPackage,sing-box-tiny)) -- 2.30.2